package com.maistars.spider.service.store.console;

import com.maistars.spider.common.exception.TopicSpiderException;
import com.maistars.spider.service.store.ExtractedFieldStore;

import java.util.List;

/**
 * @author dhr
 * @date 2021/9/25 下午7:33
 */
public class ConsoleExtractedFieldStore implements ExtractedFieldStore {

    private Integer taskInstId;

    public ConsoleExtractedFieldStore(Integer taskInstId) {
        this.taskInstId = taskInstId;
    }

    @Override
    public void writeColumnNames(List<String> columnNames) throws TopicSpiderException {
        System.out.println("taskInstId:" + taskInstId + " column names:" + columnNames);
    }

    @Override
    public void writeRecords(String url, List<String> records) throws TopicSpiderException {
//        System.out.println("taskInstId:" + taskInstId + " records:" + records);
        System.out.println(records);
    }

    @Override
    public void writeErrorUrls(String url, String errorMsg) throws TopicSpiderException {
        System.out.println("taskInstId:" + taskInstId + " errorMsg:" + errorMsg + " url:" + url);
    }
}
